package io.terminus.basic;

/**
 * @author lichunlong lcl253137@alibaba-inc.com
 * @desc 在static环境中访问非static变量为什么不可以？
 * @date 2023-09-25
 */
public class StaticDemo {

    int num = 10;

    public static void method() {
//        System.out.println("num = " + this.num);
    }
}

class Demo {

    public static void main(String[] args) {

        System.out.println(Demo.num);

        Demo d = null;
        System.out.println(d.num);
    }

    static int num = 10;

    static {
        System.out.println("我是静态代码块");
        num = 20;
    }
}